package com.consul.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
    public final static String DATE_FULL = "yyyy-MM-dd HH:mm:ss";

    /**
     * 将时间戳转换为时间
     *
     * @param time
     * @param regex
     * @return
     * @throws ParseException
     */
    public static String parseLongToDate(long time, String regex) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(regex);
        Date date = new Date(time);
        return simpleDateFormat.format(date);
    }

}
